package sctu.edu.java.year2016.team03.liyouhong.day20160530.chapter9_1;

/**
 * Created by Administrator on 2016/5/30 0030.
 * 1.编写java程序，创建一个类，并在类中创建一个成员内部类，通过成员内部类计算1到任意数的和的操作,并在外部类中测试。
 */
public class Sum {
    private int n=20;

    void mysum() {

    }

    public class Inner {
       private int j = 0;
       private int sum = 0;

        public void mysum() {
            for (int i = 0; i < n; i++) {
                sum += j;
                j++;

            }
        }
    }

    public static void main(String[] args) {
        Sum sum = new Sum();
        Inner mysum = sum.new Inner();
        mysum.mysum();
        System.out.println(mysum.sum);
    }

}
